package com.fjrcloud.dao;

import com.fjrcloud.entity.HouseholdMaster;
import com.fjrcloud.entity.ProjectGroup;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by shengjian.lin on 17-1-7.
 */
@Repository
public interface HouseholdMasterDao extends BaseDao<HouseholdMaster,Integer>{

    List<HouseholdMaster> findByIdNoAndValid(String idNo,Boolean valid);

    HouseholdMaster findByGroupInAndIdAndValid(List<ProjectGroup> groups,Integer id,Boolean valid);

//    Page<HouseholdMaster> findByGroupAndValidOrderByCreateTimeDesc(ProjectGroup group, boolean valid, Pageable pageable);
    Page<HouseholdMaster> findByGroupInAndValidOrderByCreateTimeDesc(List<ProjectGroup> groups, boolean valid, Pageable pageable);

    Page<HouseholdMaster> findByIdInAndValidOrderByCreateTimeDesc(Integer[] ids, boolean valid, Pageable pageable);

    HouseholdMaster findByCollectAddressAndValid(String address,Boolean valid);

    Page<HouseholdMaster> findByGroupInAndValidAndCodeLikeAndNameLikeAndCollectAddressLikeAndIdNoLike(List<ProjectGroup> groups,boolean valid,String code,String name,String addr,String idNo, Pageable pageable);
}
